class Binary implements RtlExp {
    private RtlBinop op;
    private Temp right;
    private Temp left;

    public Binary (RtlBinop _op, Temp _right, Temp _left){
	op =_op;
	right =_right;
	left =_left;
    }

    public RtlBinop getOp (){
	return op;
    }

    public void setOp (RtlBinop _op){
	op =_op;
    }

    public Temp getRight (){
	return right;
    }

    public void setRight (Temp _right){
	right =_right;
    }

    public Temp getLeft (){
	return left;
    }

    public void setLeft (Temp _left){
	left =_left;
    }

    public String toString(){
	return "binary" + "(" + op + " " + right.toString()
	    + " " + left.toString() + ")";
    }

    public RtlExprId getRtlExprId()
    {
	switch(op)
	{
	case EQ:
	    return RtlExprId.COMP_EQ;
	    
	case NE :
	    return RtlExprId.COMP_NE;
	    
	case LT :
	    return RtlExprId.COMP_LT;
	    
	case GT :
	    return RtlExprId.COMP_GT;
	    
	case LTEQ :
	    return RtlExprId.COMP_LTEQ;
	    
	case GTEQ :
	    return RtlExprId.COMP_GTEQ;
	    
	case PLUS :
	    return RtlExprId.ADD;
	    
	case MINUS :
	    return RtlExprId.SUB;
	    
	case MUL :
	    return RtlExprId.MUL;	
	    
	case DIV :
	    return RtlExprId.DIV;	
	    	    
	default:
	    //TODO: fix later. throw new NoSuchFieldException();
	    return null;
	}
    }
}
